Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock attestation #82

Merged
merged 18 commits into from
Jul 18, 2024
Merged

Mock attestation #82

merged 18 commits into from
Jul 18, 2024

Conversation

hu55a1n1
Copy link
Member

@hu55a1n1 hu55a1n1 commented Jul 9, 2024

Closes: #14

To test please follow the app/transfers/README.md.

@hu55a1n1 hu55a1n1 marked this pull request as ready for review July 10, 2024 08:47
@hu55a1n1 hu55a1n1 marked this pull request as draft July 10, 2024 09:12
@hu55a1n1 hu55a1n1 marked this pull request as ready for review July 12, 2024 16:12
@hu55a1n1 hu55a1n1 requested a review from thanethomson July 15, 2024 10:40
@thanethomson
Copy link
Contributor

The use of the ROOT environment variable is tripping me up here. How do you normally set that env var?

Ordinarily it's best with BASH scripts to define them such that it's clear where to trigger them from (i.e. from which folder to call them) and use relative paths as far as possible. If you need to expand a relative path to an absolute one, then there are BASH utilities/shell commands that can assist with that.

@hu55a1n1
Copy link
Member Author

The use of the ROOT environment variable is tripping me up here. How do you normally set that env var?

Good point! Unfortunately we currently require ROOT to be the absolute path. I think this is a common pattern across all our scripts.

Copy link
Contributor

@davekaj davekaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rust code looks good. I could not test the listen script because the tx was failing with

  "raw_log": "failed to execute message; message index: 0: Error parsing into type transfers_contract::msg::ExecuteMsg: Invalid type: execute wasm contract failed",

I tried to copy exactly what I had in my listen.sh script as it handles some errors in the main version, but it bugged out because it expected something different.

I think listen.sh needs a similar check for MOCK_SGX as relayer.sh has. let me know what you think

apps/transfers/scripts/start.sh Show resolved Hide resolved
@hu55a1n1
Copy link
Member Author

I think listen.sh needs a similar check for MOCK_SGX as relayer.sh has. let me know what you think

I have a slight preference for merging this PR without this change and later adding this to #96 (after merging these changes) because IIUC, update attestation is working well there, so it'll be easier to test. 🙏

@davekaj
Copy link
Contributor

davekaj commented Jul 18, 2024

Okay I agree, we can save the fix for listen.sh afterwords.

I ran the test with the MOCK_SGX and it worked, but now I did not pass the flag and I am running gramine normally, and I am getting this error:

[P1:T1:] error: libos_init() failed in init_exec_handle: Permission denied (EACCES)

Any ideas?

@hu55a1n1
Copy link
Member Author

hu55a1n1 commented Jul 18, 2024

[P1:T1:] error: libos_init() failed in init_exec_handle: Permission denied (EACCES)

When do you see this error? As soon as the enclave starts? Or at the time of handshake?

Also, if you did a export MOCK_SGX=1, make sure to unset MOCK_SGX.

@davekaj
Copy link
Contributor

davekaj commented Jul 18, 2024

MOCK_SGX was already unset! here is where it fails:

Measurement:
    647d425aacfa2ac4b6103271d578bcaa764061fa110c9791c7d147c4695e0f51
--------------------------------------------------------
... start gramine
Gramine is starting. Parsing TOML manifest file, this may take some time...
-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - sys.insecure__allow_eventfd = true         (host-based eventfd is enabled)
  - sgx.allowed_files = [ ... ]                (some files are passed through from untrusted host without verification)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

[P1:T1:] error: libos_init() failed in init_exec_handle: Permission denied (EACCES)

@hu55a1n1
Copy link
Member Author

The Gramine manifest had a bug where the bin name wasn't updated in the trusted_files array. Just pushed 60ed808 based on @davekaj's idea. Thanks for the fix @davekaj!

Copy link
Contributor

@davekaj davekaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good lets merge

@hu55a1n1 hu55a1n1 merged commit 4b3630a into main Jul 18, 2024
7 checks passed
@hu55a1n1 hu55a1n1 deleted the hu55a1n1/14-mock-attestor branch July 18, 2024 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mock impl of SGX Attestor
4 participants